package com.cheboohui.iqs.spider.pingan;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.message.BasicNameValuePair;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cheboohui.iqs.common.basic.StringUtil;
import com.cheboohui.iqs.common.basic.TimeUtil;
import com.cheboohui.iqs.common.deal.ListDeal;
import com.cheboohui.iqs.http.tool.HttpClient;
import com.cheboohui.iqs.menu.ErrorNews;
import com.cheboohui.iqs.spider.login.LoginEntity;
import com.cheboohui.iqs.spider.login.VerificationLogin;
import com.cheboohui.iqs.spring.entity.Car;
import com.cheboohui.iqs.spring.entity.Insurance;
import com.cheboohui.iqs.spring.entity.Owner;
import com.cheboohui.iqs.spring.entity.Policy;
import com.cheboohui.iqs.spring.entity.Privious;
import com.cheboohui.iqs.spring.entity.price.request.PriviousRequest;
import com.cheboohui.iqs.spring.entity.price.response.PriviousResult;

/**
 * 平安往年保单查询
 * 
 * @author xielonghai
 *
 */
public class BeforePolicyPingAn {

	/**
	 * logger:日志工具.
	 */
	private static Log log = LogFactory.getLog(BeforePolicyPingAn.class);

	/**
	 * 保单查询地址url
	 */
	private static final String policy_pingan_url = "https://icorepnbs.pingan.com.cn/icore_pnbs/do/quote/quickSearch";

	/**
	 * 投保单查询<外部调用接口>AA
	 * 
	 * @param priviousRequest
	 * @return
	 */
	public static PriviousResult checkPolicy(PriviousRequest priviousRequest) {
		String[] list = { "1", "2", "3", "4" };
		if (!ListDeal.listDeal(priviousRequest.getType(), list)) {
			return new PriviousResult(ErrorNews.C01, "保单查询类型错误:" + priviousRequest.getType());
		}

		return checkPolicyByFrameNo(priviousRequest.getLicense().getFrameNo(), priviousRequest.getType(),
				VerificationLogin.getNo());
	}

	/**
	 * 平安根据车牌查询往年保单信息<外部调用接口--AA转>A
	 * 
	 * @param licenceNo
	 * @param login
	 * @return
	 */
	public static PriviousResult checkPolicyByLicenceNo(String licenceNo, String type, LoginEntity login) {
		if (!login.isState())
			return new PriviousResult(ErrorNews.L02, "登录平安系统失败,未获取得到验证码");

		log.info(login.getOrderNo() + ",根据车牌号获取往年保单信息,车牌号:" + licenceNo);

		ArrayList<BasicNameValuePair> param = new ArrayList<BasicNameValuePair>();
		param.add(new BasicNameValuePair("departmentCode", "21825"));
		param.add(new BasicNameValuePair("employeeCode", "2180001463"));
		param.add(new BasicNameValuePair("isLoanVehicle", "0"));
		param.add(
				new BasicNameValuePair("vehicleLicenceCode", licenceNo.substring(0, 2) + "-" + licenceNo.substring(2)));

		try {
			log.info(login.getOrderNo() + ",根据车牌号获取往年保单信息,车牌号:" + licenceNo + ",查询请求开始...");

			String res = HttpClient._httpPostToBody(login.getHttpClient(), login.getHttpContext(), policy_pingan_url,
					param);

			log.info(login.getOrderNo() + ",根据车牌号获取往年保单信息,车牌号:" + licenceNo + ",查询返回结果:" + res);

			return checkPolicyTwo(res, type, login);
		} catch (Exception e) {
			log.error(login.getOrderNo() + ",根据车牌号获取往年保单信息,车牌号:" + licenceNo + ",出现异常:" + e);
			return new PriviousResult(ErrorNews.L03, "平安爬虫系统,根据车牌号获取往年保单信息出现异常:" + e.getMessage());
		}
	}

	/**
	 * 平安根据车架号查询往年保单信息<外部调用接口--AA转>B
	 * 
	 * @param frameNo
	 * @param login
	 * @return
	 */
	public static PriviousResult checkPolicyByFrameNo(String frameNo, String type, LoginEntity login) {
		if (!login.isState())
			return new PriviousResult(ErrorNews.L02, "登录平安系统失败,未获取得到验证码");

		log.info(login.getOrderNo() + ",根据车架号获取往年保单信息,车架号:" + frameNo);

		ArrayList<BasicNameValuePair> param = new ArrayList<BasicNameValuePair>();
		param.add(new BasicNameValuePair("departmentCode", "21825"));
		param.add(new BasicNameValuePair("employeeCode", "2180001463"));
		param.add(new BasicNameValuePair("isLoanVehicle", "0"));
		param.add(new BasicNameValuePair("vehicleFrameNo", frameNo));

		try {
			log.info(login.getOrderNo() + ",根据车架号获取往年保单信息,车架号:" + frameNo + ",查询请求开始...");

			String res = HttpClient._httpPostToBody(login.getHttpClient(), login.getHttpContext(), policy_pingan_url,
					param);

			log.info(login.getOrderNo() + ",根据车架号获取往年保单信息,车架号:" + frameNo + ",查询返回结果:" + res);

			return checkPolicyTwo(res, type, login);
		} catch (Exception e) {
			log.error(login.getOrderNo() + ",根据车架号获取往年保单信息,车架号:" + frameNo + ",出现异常:" + e);
			return new PriviousResult(ErrorNews.L03, "平安爬虫系统,根据车架号获取往年保单信息出现异常:" + e.getMessage());
		}
	}

	/**
	 * 根据车架号查询往年保单<报价调用接口>C
	 * 
	 * @param frameNo
	 * @param login
	 * @return
	 */
	public static JSONObject checkPolicyByFrameNo(String frameNo, LoginEntity login) {
		log.info(login.getOrderNo() + ",根据车架号获取往年保单信息,车架号:" + frameNo);

		JSONObject obj = new JSONObject();

		ArrayList<BasicNameValuePair> param = new ArrayList<BasicNameValuePair>();
		param.add(new BasicNameValuePair("departmentCode", "21825"));
		param.add(new BasicNameValuePair("employeeCode", "2180001463"));
		param.add(new BasicNameValuePair("isLoanVehicle", "0"));
		param.add(new BasicNameValuePair("vehicleFrameNo", frameNo));
		try {
			log.info(login.getOrderNo() + ",根据车架号获取往年保单信息,车架号:" + frameNo + ",查询请求开始...");

			String res = HttpClient._httpPostToBody(login.getHttpClient(), login.getHttpContext(), policy_pingan_url,
					param);

			log.info(login.getOrderNo() + ",根据车架号获取往年保单信息,车架号:" + frameNo + ",查询返回结果:" + res);

			JSONArray policy = JSONObject.parseObject(res).getJSONArray("policy");
			if (null == policy || policy.isEmpty() || policy.size() < 1) {
				log.info(login.getOrderNo() + ",根据车架号获取往年保单信息,没有发现以往保单信息. . .");
				obj.put("type", 0);
				obj.put("msg", login.getOrderNo() + ",根据车架号获取往年保单信息,没有发现以往保单信息");
				return obj;
			}

			JSONArray bus = new JSONArray();
			JSONArray tra = new JSONArray();
			for (int k = 0; k < policy.size(); k++) {
				JSONObject bi = new JSONObject();
				bi.put("bday",
						(TimeUtil.timeIsLong(TimeUtil.timeNextDay(TimeUtil.YMD) + " 00:00:00", TimeUtil.DEFAULT_TIME)
								- TimeUtil.timeIsLong(policy.getJSONObject(k).getString("insuranceBeginTime"),
										TimeUtil.DEFAULT_TIME))
								/ (24 * 60 * 60 * 1000));
				bi.put("eday",
						(TimeUtil.timeIsLong(TimeUtil.timeNextDay(TimeUtil.YMD) + " 00:00:00", TimeUtil.DEFAULT_TIME)
								- TimeUtil.timeIsLong(policy.getJSONObject(k).getString("insuranceEndTime"),
										TimeUtil.DEFAULT_TIME))
								/ (24 * 60 * 60 * 1000));
				bi.put("policy", policy.getJSONObject(k));

				if ("C51".equals(policy.getJSONObject(k).getString("planCode"))) {
					tra.add(bi);
				} else if ("C01".equals(policy.getJSONObject(k).getString("planCode"))) {
					bus.add(bi);
				} else {
					log.error(
							login.getOrderNo() + ",平安系统出现错误,发现未知保单类型:" + policy.getJSONObject(k).getString("planCode"));
					obj.put("type", 1);
					obj.put("msg",
							login.getOrderNo() + ",平安系统出现错误,发现未知保单类型:" + policy.getJSONObject(k).getString("planCode"));
					return obj;
				}
			}

			JSONObject t = dealPolicy(tra);
			if (t.getIntValue("type") > 2) {
				t.put("tra", getValue(t.getJSONObject("data"), login));
			}
			obj.put("tra", t);

			JSONObject b = dealPolicy(bus);
			if (b.getIntValue("type") > 2) {
				b.put("bus", getValue(b.getJSONObject("data"), login));
			}
			obj.put("bus", b);

			obj.put("msg", login.getOrderNo() + ",初步得到保单信息...");
			obj.put("type", 3);
			return obj;
		} catch (Exception e) {
			log.error(login.getOrderNo() + ",根据车架号获取往年保单信息,车架号:" + frameNo + ",出现异常:" + e);
			obj.put("type", 2);
			obj.put("msg", login.getOrderNo() + ",根据车架号获取往年保单信息,车架号:" + frameNo + ",出现异常:" + e.getMessage());
			return obj;
		}
	}

	/**
	 * 保单处理<C-1>
	 * 
	 * @param policy
	 * @return
	 */
	private static JSONObject dealPolicy(JSONArray policy) {
		JSONObject obj = new JSONObject();
		if (null == policy || policy.isEmpty() || policy.size() < 1) {
			obj.put("type", 0);// 无该险的保单
			return obj;
		} else {
			for (int i = 0; i < policy.size(); i++) {
				int d1 = deal(policy.getJSONObject(i));
				if (d1 > 0) {
					obj.put("type", d1);
					return obj;
				}
			}

			if (policy.size() == 1) {
				if (deal(policy.getJSONObject(0), 1)) {
					obj.put("type", 4);// 保险到期小于90天
					obj.put("bTime", TimeUtil
							.secondAdd(policy.getJSONObject(0).getJSONObject("policy").getString("insuranceEndTime")));
					obj.put("data", policy.getJSONObject(0));
					return obj;
				} else {
					obj.put("type", 3);// 有在该保险公司投保且只有过一次
					obj.put("data", policy.getJSONObject(0));
					return obj;
				}
			} else {
				for (int k = 1; k < 6; k++) {
					for (int i = 0; i < policy.size(); i++) {
						if (deal(policy.getJSONObject(i), k)) {
							obj.put("type", 3 + k);
							if (4 == obj.getIntValue("type"))
								obj.put("bTime", TimeUtil.secondAdd(
										policy.getJSONObject(i).getJSONObject("policy").getString("insuranceEndTime")));
							obj.put("data", policy.getJSONObject(i));
							return obj;
						}
					}
				}

				obj.put("type", 9);// 有在该保险公司投保过
				obj.put("data", policy.getJSONObject(0));
				return obj;
			}
		}
	}

	/**
	 * 根据投保单号获取保单详细信息
	 * 
	 * @param obj
	 * @param login
	 * @return
	 */
	private static JSONObject getValue(JSONObject obj, LoginEntity login) {
		try {
			log.info(login.getOrderNo() + ",根据投保单号获取保单详细信息--" + obj.getJSONObject("policy").getString("policyNo")
					+ ",开始");
			String url = "https://icorepnbs.pingan.com.cn/icore_pnbs/do/app/quotation/quickSearchVoucher";
			String res = HttpClient._httpPostToBody(login.getHttpClient(), login.getHttpContext(), url,
					checkPolicyByNo(obj.getJSONObject("policy").getString("planCode") + "PolicyNo",
							obj.getJSONObject("policy").getString("policyNo")));
			log.info(login.getOrderNo() + ",根据投保单号获取保单详细信息--" + obj.getJSONObject("policy").getString("policyNo")
					+ ",结束");
			return JSONObject.parseObject(res);
		} catch (Exception e) {
			log.error(login.getOrderNo() + ",根据投保单号获取保单详细信息,出现异常:" + e);
			return null;
		}
	}

	/**
	 * 处理判断是否可以进行报价<C-2>
	 * 
	 * @param p
	 * @return
	 */
	private static int deal(JSONObject p) {
		if (p.getIntValue("bday") <= 0)
			return 1;// 已经购买保险
		else {// if(p.getIntValue("bday")>0){
			if (p.getIntValue("eday") <= -90)
				return 2;// 保险到期大于等于90天
			else
				return 0;
		}
	}

	/**
	 * 处理判断保险到期在哪个区间<C-3>
	 * 
	 * @param p
	 * @param t
	 * @return
	 */
	private static boolean deal(JSONObject p, int t) {
		if (1 == t) {// 上年投保且到期90天内
			return p.getIntValue("eday") <= 0;
		} else {
			return (p.getIntValue("eday") > 365 * (t - 2) && p.getIntValue("eday") <= 365 * (t - 1));
		}
	}

	/**
	 * 根据第一步(据车牌或车架查询得到投保单号列表处理得到需求的保单号，在根据保单号查询投保单详情)
	 * 
	 * @param one
	 * @param login
	 * @return
	 */
	public static PriviousResult checkPolicyTwo(String oneResult, String type, LoginEntity login) {
		if (!login.isState())
			return new PriviousResult(ErrorNews.L02, "登录平安系统失败,未获取得到验证码");

		JSONObject tra = null;
		JSONObject bus = null;

		log.info(login.getOrderNo() + ",开始判断投保单信息....");

		JSONArray policy = JSONObject.parseObject(oneResult).getJSONArray("policy");
		for (int k = 0; k < policy.size(); k++) {
			if ("C51".equals(policy.getJSONObject(k).getString("planCode"))) {
				if (null != tra)
					continue;
				if (dealPolicy(policy.getJSONObject(k), type))
					tra = policy.getJSONObject(k);
			} else if ("C01".equals(policy.getJSONObject(k).getString("planCode"))) {
				if (null != bus)
					continue;
				if (dealPolicy(policy.getJSONObject(k), type))
					bus = policy.getJSONObject(k);
			} else {
				log.error(login.getOrderNo() + ",平安系统出现错误,发现未知保单类型:" + policy.getJSONObject(k).getString("planCode"));
				return new PriviousResult(ErrorNews.L03, "平安系统出现错误,发现未知保单类型");
			}
		}

		log.info(login.getOrderNo() + ",判断投保单信息完成，进入根据其保单号查询具体详细信息开始....");

		if (null == tra && null == bus) {
			log.error(login.getOrderNo() + ",无此保单类型的保单数据。。。。");
			return new PriviousResult(ErrorNews.C03, "无此保单类型的保单数据");
		}

		try {
			String url = "https://icorepnbs.pingan.com.cn/icore_pnbs/do/app/quotation/quickSearchVoucher";
			Policy p = new Policy();
			Owner o = null;
			Car c = null;
			List<Insurance> list = new ArrayList<>();

			if (null != bus) {
				log.info(login.getOrderNo() + ",发现商业险投保单号:" + bus.getString("policyNo") + ",开始查询其详情...");
				String res = HttpClient._httpPostToBody(login.getHttpClient(), login.getHttpContext(), url,
						checkPolicyByNo(bus.getString("planCode") + "PolicyNo", bus.getString("policyNo")));

				log.info(login.getOrderNo() + ",根据商业险投保单号查询查询完，开始处理数据....");

				JSONObject resultBus = JSONObject.parseObject(res);

				if (null == c)
					c = getCar(resultBus.getJSONObject("autoModelType"));
				if (null == o)
					o = getOwner(resultBus.getJSONObject("voucher").getJSONObject("applicantInfo"));
				list = getBusList(resultBus.getJSONObject("voucher").getJSONArray("c01DutyList"));
				if (null != list && !list.isEmpty()) {
					for (Insurance i : list) {
						i.setBeginTime(bus.getString("insuranceBeginTime"));
						i.setEndTime(bus.getString("insuranceEndTime"));
					}
				}

				p.setBusinessInsuredNo(bus.getString("policyNo"));
				p.setBusinessTotal(bus.getDouble("totalAmount"));

				log.info(login.getOrderNo() + ",根据商业险投保单号查询查询完，处理数据完成....");
			}

			if (null != tra) {
				log.info(login.getOrderNo() + ",发现交强险投保单号:" + tra.getString("policyNo") + ",开始查询其详情...");
				String res = HttpClient._httpPostToBody(login.getHttpClient(), login.getHttpContext(), url,
						checkPolicyByNo(tra.getString("planCode") + "PolicyNo", tra.getString("policyNo")));

				log.info(login.getOrderNo() + ",根据交强险投保单号查询查询完，开始处理数据....");

				JSONObject resultTra = JSONObject.parseObject(res);
				if (null == c)
					c = getCar(resultTra.getJSONObject("autoModelType"));
				if (null == o)
					o = getOwner(resultTra.getJSONObject("voucher").getJSONObject("applicantInfo"));
				Insurance i = new Insurance();
				i.setCode("TP");
				i.setValue("交强险");
				i.setPrice(tra.getDouble("totalAmount"));
				i.setBeginTime(tra.getString("insuranceBeginTime"));
				i.setEndTime(tra.getString("insuranceEndTime"));
				list.add(i);

				p.setTraficInsuredNo(tra.getString("policyNo"));
				p.setTrafic(tra.getDouble("totalAmount"));
				p.setTax(resultTra.getJSONObject("voucher").getJSONObject("vehicleTaxInfo").getDouble("totalTaxMoney"));

				log.info(login.getOrderNo() + ",根据交强险投保单号查询查询完，处理数据完成....");
			}

			p.setTotal();

			Privious result = new Privious();
			result.setCar(c);
			result.setInsuranceList(list);
			result.setOwner(o);
			result.setPolicy(p);

			log.info(login.getOrderNo() + ",判断投保单信息完成，进入根据其保单号查询具体详细信息以及处理返回结果结束....");

			return new PriviousResult(result);
		} catch (Exception e) {
			log.error(login.getOrderNo() + ",根据投保单号获取保单信息,出现异常:" + e);
			return new PriviousResult(ErrorNews.L03, "平安爬虫系统,根据投保单号获取保单信息出现异常:" + e.getMessage());
		}
	}

	/**
	 * 处理查询数据得车主信息
	 * 
	 * @param owner
	 * @return
	 */
	private static Owner getOwner(JSONObject owner) {
		if (null == owner || owner.isEmpty())
			return null;
		Owner o = new Owner();
		o.setName(owner.getString("personnelName"));
		o.setIdCard(owner.getString("certificateTypeNo"));
		return o;
	}

	/**
	 * 处理查询数据得车辆信息
	 * 
	 * @param car
	 * @return
	 */
	private static Car getCar(JSONObject car) {
		if (null == car || car.isEmpty())
			return null;
		Car c = new Car();
		c.setPurchase(car.getDoubleValue("purchasePrice"));
		c.setSeats(car.getIntValue("seats"));
		c.setLabelNo(car.getString("autoModelName"));
		c.setYear(car.getString("firstSaleDate"));
		c.setModels(car.getString("pa18AliasName"));
		return c;
	}

	/**
	 * 处理查询数据得商业险选择信息
	 * 
	 * @param busList
	 * @return
	 */
	public static List<Insurance> getBusList(JSONArray busList) {
		List<Insurance> list = new ArrayList<>();
		if (null == busList || busList.isEmpty())
			return list;
		for (int k = 0; k < busList.size(); k++) {
			JSONObject obj = busList.getJSONObject(k);
			String code = getCode(null == obj.getString("dutyCode") ? "" : obj.getString("dutyCode").trim());
			if (StringUtil.isNulls(code)) {
				log.error("车险类型出险未知类型:" + obj);
				continue;
			}
			Insurance i = new Insurance();
			i.setCode(code);
			// if ("BPD".equals(code))
			i.setValue(getCodeValue(code));
			// else
			// i.setValue(obj.getString("dutyName"));
			i.setAmount(obj.getDouble("insuredAmount"));
			i.setPrice(obj.getDouble("totalActualPremium"));

			list.add(i);
		}

		return list;
	}

	/**
	 * 保险类型
	 * 
	 * @param dutyCode
	 * @return
	 */
	private static String getCode(String dutyCode) {
		switch (dutyCode) {
		case "01":
			return "BL";
		case "27":
			return "BLD";
		case "02":
			return "BTR";
		case "28":
			return "BTRD";
		case "03":
			return "BT";
		case "48":
			return "BTD";
		case "04":
			return "BD";
		case "49":
			return "BDD";
		case "05":
			return "BP";
		case "80":
			return "BPD";
		case "08":
			return "BG";
		case "18":
			return "BNP";
		case "77":
			return "BNPD";
		case "17":
			return "BN";
		case "75":
			return "BND";
		case "41":
			return "BW";
		case "79":
			return "BWD";
		case "57":
			return "BR";
		default:
			return "";
		}
	}

	private static String getCodeValue(String code) {
		switch (code) {
		case "BL":
			return "机动车损失险";
		case "BLD":
			return "机动车损失险不计免赔";
		case "BTR":
			return "第三责任险";
		case "BTRD":
			return "第三责任险不计免赔";
		case "BT":
			return "盗抢险";
		case "BTD":
			return "盗抢险不计免赔";
		case "BD":
			return "车上人员责任险(司机)";
		case "BDD":
			return "车上人员责任险(司机)不计免赔";
		case "BP":
			return "车上人员责任险(乘客)";
		case "BPD":
			return "车上人员责任险(乘客)不计免赔";
		case "BG":
			return "玻璃险";
		case "BNP":
			return "自然损失险";
		case "BNPD":
			return "自然损失险不计免赔";
		case "BN":
			return "划痕险";
		case "BND":
			return "划痕险不计免赔";
		case "BW":
			return "发动机涉水损失险";
		case "BWD":
			return "发动机涉水损失险不计免赔";
		case "BR":
			return "指定修理险";
		default:
			return "";
		}
	}

	/**
	 * 保单判断
	 * 
	 * @param policy
	 * @param type
	 * @return
	 */
	private static boolean dealPolicy(JSONObject policy, String type) {
		long begin = TimeUtil.timeIsLong(policy.getString("insuranceBeginTime"), TimeUtil.DEFAULT_TIME);
		long end = TimeUtil.timeIsLong(policy.getString("insuranceEndTime"), TimeUtil.DEFAULT_TIME);
		long now = new Date().getTime();
		int year = Integer.valueOf(TimeUtil.timeFormat(new Date(), "yyyy"));

		if ("1".equals(type)) {// 正在生效中保单
			return (now > begin && now < end);
		} else if ("2".equals(type)) {// 上年投保-不管是否还有效的保单
			long endYear = TimeUtil.timeIsLong(year + "-12-12 23:59:59", TimeUtil.DEFAULT_TIME);
			long beginYear = TimeUtil.timeIsLong(year + "-01-01 00:00:01", TimeUtil.DEFAULT_TIME);

			return (begin < endYear && begin > beginYear);
		} else if ("3".equals(type)) {// 已买的下年保单
			long endYear = TimeUtil.timeIsLong(year + "-12-12 23:59:59", TimeUtil.DEFAULT_TIME);
			long beginYear = TimeUtil.timeIsLong(year + "-01-01 00:00:01", TimeUtil.DEFAULT_TIME);

			return (end > endYear && begin > beginYear);
		} else if ("4".equals(type)) {// 前年投保的单子
			year = year - 1;
			long endYear = TimeUtil.timeIsLong(year + "-12-12 23:59:59", TimeUtil.DEFAULT_TIME);
			long beginYear = TimeUtil.timeIsLong(year + "-01-01 00:00:01", TimeUtil.DEFAULT_TIME);

			return (begin < beginYear && end > beginYear && end < endYear);
		} else {
			return true;
		}
	}

	/**
	 * 根据投保单号查询投保单详情
	 * 
	 * @param policyNo
	 * @param login
	 * @return
	 */
	public static ArrayList<BasicNameValuePair> checkPolicyByNo(String code, String policyNo) {
		ArrayList<BasicNameValuePair> httpparam = new ArrayList<BasicNameValuePair>();
		httpparam.add(new BasicNameValuePair("bidFlag", "0"));
		httpparam.add(new BasicNameValuePair("businessSourceCode", "2"));
		httpparam.add(new BasicNameValuePair("businessSourceDetailCode", "3"));
		httpparam.add(new BasicNameValuePair("channelSourceCode", "G"));
		httpparam.add(new BasicNameValuePair("channelSourceDetailCode", "F"));
		httpparam.add(new BasicNameValuePair("departmentCode", "21825"));
		httpparam.add(new BasicNameValuePair("insuranceType", "1"));
		httpparam.add(new BasicNameValuePair("insuredNumber", "1"));
		httpparam.add(new BasicNameValuePair("isFromCNBS", "0"));
		httpparam.add(new BasicNameValuePair("isSelectDriver", "0"));
		httpparam.add(new BasicNameValuePair("loanVehicle", "0"));
		httpparam.add(new BasicNameValuePair("nbaHotshot", "nbaHotshot"));
		httpparam.add(new BasicNameValuePair("ownershipAttributeCode", "03"));
		httpparam.add(new BasicNameValuePair("planCode", "C01"));
		httpparam.add(new BasicNameValuePair("productCode", ""));
		httpparam.add(new BasicNameValuePair("rateClassFlag", "14"));
		httpparam.add(new BasicNameValuePair("saleAgentCode", "2180001463"));
		httpparam.add(new BasicNameValuePair("secondLevelDepartmentCode", "218"));
		httpparam.add(new BasicNameValuePair("usageAttributeCode", "02"));
		httpparam.add(new BasicNameValuePair("voucherType", "1"));
		httpparam.add(new BasicNameValuePair(code, policyNo));
		return httpparam;
	}
}
